define(function(require) {
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");

	var Model = function() {
		this.callParent();
		this.url = "http://yun.jiawoltd.com";
	};

	Model.prototype.modelLoad = function(event) {
		var userId = localStorage.getItem("USER_ID");
		var userName = localStorage.getItem("USER_NAME");
		var fullName = $(this.getElementByXid("fullName"));
		fullName.text(userName);
		//alert(userName);
		$.ajax({
			cache : false,
			type : "GET",
			timeout : 10000, // 超时时间设置，单位毫秒
			url : this.url + "/mobile/getUserAvatar/" + userId,
			data : {},
			async : false,
			error : function(request) {
				justep.Util.hint("网络错误,请稍后再试!");
			},
			success : function(resp) {
				console.info(resp);
				if (resp) {
					$('[xid=headimage]').attr("src", resp.src);
				} else {
					$('[xid=headimage]').attr("src", require.toUrl("../images/avatar.jpg"));
				}
			}
		});

	};

	Model.prototype.loginBtnClick = function(event) {
		localStorage.clear();
		justep.Shell.showPage("login");
	};

	Model.prototype.div11Click = function(event){
		justep.Shell.setIsSinglePage();
		justep.Shell.showPage(require.toUrl('./about.w'), {});
	};

	Model.prototype.div7Click = function(event){
		justep.Util.hint("暂无消息!");
	};

	return Model;
});